/*     */ package com.lmpop.trade.ti_casetrack;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_casetrackInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_casetrackInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public int getMaxCountById(String case_id)
/*     */   {
/*  25 */     int count = 0;
/*  26 */     List list = this.queryList.getList("getMaxCountById", case_id);
/*  27 */     if ((list != null) && (list.size() > 0) && 
/*  28 */       (((Hashtable)list.get(0)).get("count") != null)) {
/*  29 */       String str = ((Hashtable)list.get(0)).get("count").toString();
/*  30 */       if ((str != null) && (!str.equals("null"))) {
/*  31 */         count = Integer.parseInt(str.toString());
/*     */       }
/*     */     }
/*  34 */     count++;
/*  35 */     return count;
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map) {
/*  39 */     Ti_casetrack ti_casetrack = new Ti_casetrack();
/*  40 */     RandomID bean = new RandomID();
/*  41 */     String pri_key = bean.GenTradeId();
/*  42 */     ti_casetrack.setTrade_id(pri_key);
/*  43 */     ti_casetrack.setCase_id(map.getString("case_id"));
/*  44 */     ti_casetrack.setContact_result(map.getString("contact_result"));
/*  45 */     ti_casetrack.setOperator_user(map.getString("operator_user"));
/*     */ 
/*  47 */     ti_casetrack.setContact_count(getMaxCountById(map.getString("case_id")));
/*     */ 
/*  49 */     String result_code = "0";
/*     */     try {
/*  51 */       insert(dbmMgr, ti_casetrack);
/*     */     } catch (ApplicationException e) {
/*  53 */       e.printStackTrace();
/*  54 */       result_code = "1";
/*     */     }
/*  56 */     map.setString("result_code", result_code);
/*  57 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_casetrack ti_casetrack)
/*     */     throws ApplicationException
/*     */   {
/*  66 */     dbmMgr.update("insertTi_casetrack", ti_casetrack);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  76 */     String pkid_string = map.getString("pkid");
/*  77 */     String result_code = "0";
/*     */     try {
/*  79 */       if (!pkid_string.equals("")) {
/*  80 */         String[] pkStr = pkid_string.split("\\|");
/*  81 */         for (int i = 0; i < pkStr.length; i++) {
/*  82 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  86 */       e.printStackTrace();
/*  87 */       result_code = "1";
/*     */     }
/*  89 */     map.setString("result_code", result_code);
/*  90 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  99 */     dbmMgr.update("deleteTi_casetrack", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 108 */     Ti_casetrack ti_casetrack = new Ti_casetrack();
/* 109 */     ti_casetrack.setTrade_id(map.getString("trade_id"));
/* 110 */     ti_casetrack.setCase_id(map.getString("case_id"));
/* 111 */     ti_casetrack.setContact_time(map.getString("contact_time"));
/* 112 */     ti_casetrack.setContact_result(map.getString("contact_result"));
/* 113 */     ti_casetrack.setOperator_user(map.getString("operator_user"));
/* 114 */     ti_casetrack.setContact_count(map.getInt("contact_count"));
/* 115 */     ti_casetrack.setOperator_time(map.getString("operator_time"));
/*     */ 
/* 117 */     String result_code = "0";
/*     */     try {
/* 119 */       update(dbmMgr, ti_casetrack);
/*     */     } catch (ApplicationException e) {
/* 121 */       e.printStackTrace();
/* 122 */       result_code = "1";
/*     */     }
/* 124 */     map.setString("result_code", result_code);
/* 125 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_casetrack ti_casetrack)
/*     */     throws ApplicationException
/*     */   {
/* 134 */     dbmMgr.update("updateTi_casetrack", ti_casetrack);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 144 */     Hashtable ti_casetrack = (Hashtable)obj;
/* 145 */     if (start == 0)
/* 146 */       start = 0;
/*     */     else {
/* 148 */       start = (start - 1) * limit;
/*     */     }
/* 150 */     ti_casetrack.put("start", Integer.valueOf(start));
/* 151 */     ti_casetrack.put("limit", Integer.valueOf(limit));
/* 152 */     return this.queryList.getList("getListByTi_casetrackPage", ti_casetrack);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 163 */     Hashtable ti_casetrack = (Hashtable)obj;
/* 164 */     List list = this.queryList.getList("getCountByObjTi_casetrack", ti_casetrack);
/* 165 */     int count = 0;
/* 166 */     if ((list != null) && (list.size() > 0)) {
/* 167 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 168 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 169 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 172 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 182 */     return this.queryList.getList("getTi_casetrackByPk", pk);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_casetrack.Ti_casetrackInfo
 * JD-Core Version:    0.6.0
 */